﻿using KaytechSoftware.Cms.Entities;
using KaytechSoftware.Cms.Services.Interfaces;
using KaytechSoftware.Cms.Services.Interfaces.Entity;

namespace KaytechSoftware.Cms.Services.Dto
{
    public class PageDto : IDto
    {
        public long Id { get; set; }
        public string Title { get; set; }
        public string Description { get; set; }
        public string LeftSideRendererName { get; set; }
        public string RightSideRendererName { get; set; }
        public string LeftSideRendererCode { get; set; }
        public string RightSideRendererCode { get; set; }
        public long LeftSideRendererId { get; set; }
        public long RightSideRendererId { get; set; }

        public PageDto(Page page)
        {
            Id = page.Id;
            Title = page.Title;
            Description = page.Description;
            LeftSideRendererId = page.LeftSideRendererId;
            RightSideRendererId = page.RightSideRendererId;
            if (page.LeftSideRenderer != null)
            {
                LeftSideRendererName = page.LeftSideRenderer.Name;
                LeftSideRendererCode = page.LeftSideRenderer.Code;
            }

            if (page.RightSideRenderer != null)
            {
                RightSideRendererName = page.RightSideRenderer.Name;
                RightSideRendererCode = page.RightSideRenderer.Code;
            }
        }

        public PageDto()
        {

        }
    }
}
